package com.heima.search.controller;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.search.entity.dto.HistorySearchDto;
import com.heima.search.service.ApUserSearchService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping(path = "/api/v1/history")
public class ApUserSearchController {

    @Resource
    private ApUserSearchService apUserSearchService;

    /**
     * 查询搜索历史记录列表
     *
     * @return
     */
    @PostMapping(path = "/load")
    public ResponseResult load() {
        return apUserSearchService.load();
    }

    /**
     * 删除搜索历史记录
     *
     * @param dto
     * @return
     */
    @PostMapping(path = "/del")
    public ResponseResult delete(@RequestBody HistorySearchDto dto) {
        return apUserSearchService.delete(dto);
    }
}
